<template>
  <div class='popular-playlist mt20'>
    <h5 class='fc333 fs12 like-title pb10 solid-border-bottom'>热门歌单</h5>
    <div class="popular-ul mt20">
        <ul v-for="item in relatedPlaylistData" :key=item.key>
            <li class='clearfix popular-li mb10'>
                <div class="fl">
                    <a class="disinblock" @click='routerPlaylist(item.id)'>
                        <img class="popular-img" :src=item.coverImgUrl :title=item.name>
                    </a>
                </div>
                <div class="fr popular-li-con ml10">
                    <a class='disinblock fs14 popular-name'
                    :title=item.name @click='routerPlaylist(item.id)'>{{ item.name }}</a>
                    <a href="javascript:;" :title=item.creator.nickname 
                      class='fs12 popular-playlist-author fcgray'>by {{ item.creator.nickname }}</a>
                </div>
            </li>
        </ul>
    </div>
  </div>
</template>

<script>
export default {
    name: 'popularPlaylist',
    props: ['relatedPlaylist'],
    data() {
        return {
            relatedPlaylistData: ''
        }
    },
    methods: {
        routerPlaylist(row){
            this.$router.push({path:'/playlist', query:{ id:row}})
        }
    },
    watch: {
        relatedPlaylist() {
            this.relatedPlaylistData = this.relatedPlaylist
        }
    }
}
</script>

<style lang='less' scoped>
.popular-ul {
    width: 100%;
    .popular-li {
        display: flex;
        width: 100%;
        .popular-img {
            width: 50px;
            height: 50px;
        }
        .popular-li-con {
            width: calc(100% - 50px);
            .popular-name {
                width: 100%;
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
            }
        }
    }
}
</style>